#include<iostream>
#include<cstdio>
#include<clocale>
#include<conio.h>
#define int long long
using namespace std;
/*
TARGET:
given N,L,R,
output a number X between L&R(inclusive) that maximizes N%X

(output

x|max(n%x|L<=x<=R)

)*/
signed main(){
    freopen("candy.in","r",stdin);
    freopen("candy.out","w",stdout);
    int n,L,R;
    cin >> n >> L >> R;
    int div = L/n;
    int rs;
    if(L%n==0){
        rs = div*n;
    }else{
        rs = (div+1)*n;
    }
    if((L<=rs)&&(rs<=R)){
        /*
        ---------------L--(l%n)--COUT-rs---R------------------->
        */
        cout << n-1 << endl;
    }else{
        /*
        --------------L---(l%n)----COUT-----rs----------------->
                                    R
        */
        cout << n-(rs-R) << endl;
    }
}
